<!doctype html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
  <title>Bootstrap 101 Template</title>
  <!-- Bootstrap -->
  <link th:insert="common/head :: commonheader">
</head>
<!--<body class="login-body">-->
<body style="background-color: #F5F6FA">
<div class="container">
  <div class="row clearfix">
    <div class="col-md-12 column">
      <div th:insert="common/head :: header">

      </div>
      <div class="jumbotron" style="background-color: #fff; padding-top: 20px; padding-bottom: 10px; margin-bottom: 5px; border: 1px solid #eeeeee;">
<!--        大类工作种类-->
        <div class="container">
          <div class="row clearfix">
            <div class="col-md-12 column" style="border: 1px #eeeeee solid;">
              <ul class="nav nav-pills">
                <li class="disabled">
                  <a href="#">工种</a>
                </li>
                <li>
                  <a th:href="@{/findwork/}">全部分类</a>
                </li>
                <!--对请求内容进行拼接，w代表工种， s代表详细工作分类， p代表省份， c代表城市 通过对标签的选择来筛选出想要的招工信息-->
                <!--比如 想要筛选工种为服务业/临时工/兼职，地区为广东广州的工作 则会拼接出/01w-05s-01p-07c-的请求参数然后在controller中进行获取招工信息-->
                <!--#httpServletRequest.getRequestURI()是获取去掉localhost的当前路径-->
                <!--#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/'))取当前路径/findwork/后面的路径也就是拼接地址-->
                <li th:each="workCategorie:${workCategories}">
                  <!--判断当前路径中是否选中了工种和工种中的详细工作种类，通过判断拼接路径中是否同时含有w和s-->
                  <!--若工种和工种中的详细工作种类都被选中，比如选了服务业且选了服务业中的临时工/兼职 再次点击选中工种时，会把详细工种排除 01w-05s- 变成 02w- -->
                  <!--这样就不会导致选中别的工种时，还是显示之前详细工种的内容-->
                  <a th:if="${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('w') && #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('s')}"
                     th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(0, #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('w')-#strings.length(workCategorie.getId()))} +
                   ${workCategorie.getId()} +
                   ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('w'), #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).length()).replace(#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().indexOf('s')-2, #httpServletRequest.getRequestURI().indexOf('s')+2), '')}}"
                     th:text="${workCategorie.getKind()}">
                  </a>
                  <!--判断当前路径是否只选中了工种而为选中详细工种-->
                  <!--若判断为true，则只改变工种的编号即可 如 01w- 改为 02w- -->
                  <a th:if="${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('w') && !#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('s')}"
                     th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(0, #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('w')-#strings.length(workCategorie.getId()))} +
                     ${workCategorie.getId()} +
                     ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('w'), #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).length())}}"
                     th:text="${workCategorie.getKind()}">
                  </a>
                  <!--判断当前路径是否选中了工种-->
                  <!--若判断为true，则直接在当前地址后面添加上该工种的编号即可 如 01p-08c 改为 01p-08c-01w- -->
                  <a th:if="${!#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('w')}" th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/'))} + ${workCategorie.getId() + 'w-'}}" th:text="${workCategorie.getKind()}"></a>
                </li>

              </ul>
<!--              细分工作种类-->
              <ul class="nav nav-pills" th:if="${sonWorkCategories!=null}">
                <li class="disabled">
                  <a href="#">分类</a>
                </li>
                <li th:each="sonWorkCategorie:${sonWorkCategories}">
                  <!--判断当前路径是否选中了详细工种-->
                  <!--若判断为true，则点击其他详细工种时，只改变当前拼接地址中的详细工种编号即可 如01w-05s 改变为 01w-06s -->
                  <a th:if="${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('s')}"
                     th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(0, #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('s') - #strings.length(sonWorkCategorie.getId()))} +
                     ${sonWorkCategorie.getId()} +
                     ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('s'), #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).length())}}"
                     th:text="${sonWorkCategorie.getKind()}">
                  </a>
                  <!--判断当前路径是否没有选中详细工种-->
                  <!--若判断为true，则当选中详细工种时，只需要在当前拼接地址后面添加该详细工种的编号即可 如01w 改变为 01w-05s -->
                  <!--下面的地址筛选原理跟工种一样-->
                  <a th:if="${!#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('s')}"  th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/'))} + ${sonWorkCategorie.getId()} + 's-'}" th:text="${sonWorkCategorie.getKind()}"></a>
                </li>

              </ul>
<!--              省份-->
              <ul class="nav nav-pills">
                <li class="disabled">
                  <a href="#">省份</a>
                </li>
                <li>
                  <a th:href="@{/findwork/}">全国</a>
                </li>
                <li th:each="region:${regions}">
                    <a th:if="${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('p') && #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('c')}"
                       th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(0, #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('p')-#strings.length(region.getId()))} +
                       ${region.getId()} +
                       ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('p'), #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).length()).replace(#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().indexOf('c')-2, #httpServletRequest.getRequestURI().indexOf('c')+2), '')}}"
                       th:text="${region.getPlace()}">
                    </a>
                    <a th:if="${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('p') && !#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('c')}"
                       th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(0, #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('p')-#strings.length(region.getId()))} +
                       ${region.getId()} +
                       ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('p'), #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).length())}}"
                       th:text="${region.getPlace()}">
                    </a>
                    <a th:if="${!#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('p')}" th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/'))}  + ${region.getId() + 'p-'}}" th:text="${region.getPlace()}"></a>
                </li>
              </ul>
<!--              城市-->
              <ul class="nav nav-pills" th:if="${sonRegions!=null}">
                <li class="disabled">
                  <a href="#">城市</a>
                </li>
                <li th:each="sonRegion:${sonRegions}">
                  <a th:if="${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('c')}"
                     th:href="@{'/findwork' +
                     ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(0, #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('c')-#strings.length(sonRegion.getId()))} +
                     ${sonRegion.getId()} +
                     ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).substring(#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).indexOf('c'), #httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).length())}}"
                     th:text="${sonRegion.getPlace()}">
                  </a>
                  <a th:if="${!#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/')).contains('c')}" th:href="@{'/findwork' + ${#httpServletRequest.getRequestURI().substring(#httpServletRequest.getRequestURI().lastIndexOf('/'))} + ${sonRegion.getId()} + 'c-'}" th:text="${sonRegion.getPlace()}"></a>
                </li>
              </ul>

              <ul class="breadcrumb">
                <li>
                  <a th:href="@{/findwork/}">首页</a>
                </li>
                <li class="active" th:if="${category!=null}" th:text="${category}">
                </li>
                <li class="active" th:if="${region!=null}" th:text="${region}">
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div>
    <div class="row">
      <div class="col-md-12">

        <div class="media well findwork-work" th:each="work:${page.list}">
          <a th:href="@{'/toBoss/'+ ${work.getId()}}">
            <div class="media-body">
              <h4 class="media-heading">
                <b th:text="${work.getTitle().length()<14?work.getTitle():work.getTitle().substring(0,14)+'...'}"></b>
                <div class="text-right" style="float: right"><span class="glyphicon glyphicon-fire" style="color: red" th:if="${work.getState()==0}">正在招</span></div>
                <div class="text-right" style="float: right"><span class="glyphicon glyphicon-fire" style="color: #6b6969" th:if="${work.getState()==1}">已招满</span></div>
              </h4>
              <div th:text="${work.getWorkDescribe().length()<100?work.getWorkDescribe():work.getWorkDescribe().substring(0,100)}+'...'" style="height: 30px;">
              </div>
              <div class="media" >
                <a href="#" class="pull-left"><img th:src="@{'/user/' + ${work.getUser().getUserImg()}}" height="35" width="35" class="media-object" alt='' /></a>
                <div class="media-body">
                  <div style="margin-top: 8px; padding: 0px;">联系人:
                    <div style="display: inline-block" th:text="${work.getUser().getRealName()}">
                    </div>
                    发布时间:
                    <div style="display: inline-block" th:text="${work.getPublishTime()}">
                    </div>
                    <a class="btn btn-default" href="#" role="button" style="float:right" th:href="@{'/toBoss/' + ${work.getId()}}">立刻联系</a>
                  </div>
                </div>
              </div>
            </div>
          </a>
        </div>

      </div>
    </div>
  </div>

  <div class="ui attached segment" style="display:flex; justify-content:center;">
    <table class="m-mobile-wide">
      <tbody>
      <tr align="center">
        <td>
          <a th:href="@{${#httpServletRequest.getRequestURI()} + '?pageNum=' + ${page.pageNum - 1}}"  class="ui button basic mini" th:unless="${page.isFirstPage}" style="margin-right: 15px">上一页</a>
        </td>
        <td>
          第
          <h8 th:text="${page.pageNum}">2</h8>
          页/共
          <h8 th:text="${page.pages}">4</h8>
          页
          共
          <h8 th:text="${page.total}">29</h8>
          条
        </td>
        <td> &nbsp;</td>
        <td  style="float: right">
          <a th:href="@{${#httpServletRequest.getRequestURI()} + '?pageNum=' + ${page.pageNum+1}}" class="ui button basic mini " style="float: right; margin-left: 15px" th:unless="${page.isLastPage}">下一页</a>
        </td>
      </tr>
      </tbody>
    </table>
  </div>
  <footer th:insert="common/head :: footer">

  </footer>
</div>
</body>
</html>